// pages/integration/integration.js
var common = require("../../../common/common.js").common;

const {$Toast: $Toast} = require("../../../dist/base/index");

Page({
    /**
   * 页面的初始数据
   */
    data: {
        current_period: [ {
            backgroundImg: "background:linear-gradient(90deg,#5D99E0,#6EB5F5)",
            imgUrl: "../../images/jf.png"
        }, {
            backgroundImg: "background:linear-gradient(90deg,#FD3B41,#FF5178)",
            imgUrl: "../../images/hb.png"
        }, {
            backgroundImg: "background:linear-gradient(90deg,#A969E9,#B873FD)",
            imgUrl: ""
        } ],
        //当前活动背景色&图片
        bgIsHide: true,
        //黑色透明背景是否隐藏
        taskIsHide: true
    },
    //获取用户信息
    getUsersInfomation: function() {
        var that = this;
        var openid = wx.getStorageSync("user").openid;
        common.request({
            endpoint: "My/myinfo/myinfo",
            method: "post",
            data: {
                openid: openid
            },
            success: res => {
                console.log(res);
                that.setData({
                    info: res.extra
                });
            }
        });
    },
    lookTaskDetail() {
        this.setData({
            bgIsHide: false,
            //黑色透明背景显示
            taskIsHide: false
        });
    },
    cancel() {
        this.setData({
            bgIsHide: true,
            //黑色透明背景隐藏
            taskIsHide: true
        });
    },
    /**
   * 生命周期函数--监听页面加载
   */
    onLoad: function(options) {
        var that = this;
        this.setData({
            domain: app.globalData.domain.slice(0, -10)
        });
        that.getUsersInfomation();
    },
    /**
   * 生命周期函数--监听页面初次渲染完成
   */
    onReady: function() {},
    /**
   * 生命周期函数--监听页面显示
   */
    onShow: function() {},
    /**
   * 生命周期函数--监听页面隐藏
   */
    onHide: function() {},
    /**
   * 生命周期函数--监听页面卸载
   */
    onUnload: function() {},
    /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
    onPullDownRefresh: function() {},
    /**
   * 页面上拉触底事件的处理函数
   */
    onReachBottom: function() {},
    /**
   * 用户点击右上角分享
   */
    onShareAppMessage: function() {}
});